﻿
using System;
namespace YmtRpc.Domain
{
    /// <summary>
    /// 服务依赖采样数据的实体类
    /// </summary>
    public class ServiceDependencySampling
    {
        /// <summary>
        ///服务依赖采样记录的唯一键
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 服务消费者的应用编号
        /// </summary>
        public string ConsumerAppId { get; set; }

        /// <summary>
        /// 接口名称
        /// </summary>
        public string ApiName { get; set; }

        /// <summary>
        /// 服务提供者的应用编号
        /// </summary>
        public string ProviderAppId { get; set; }

        /// <summary>
        /// 接口地址
        /// </summary>
        public string ApiPath { get; set; }

        /// <summary>
        /// 采样时间段开始时间
        /// </summary>
        public DateTime BeginTime { get; set; }

        /// <summary>
        /// 采样时间段结束时间
        /// </summary>
        public DateTime EndTime { get; set; }

        /// <summary>
        /// 采样时间段为多少秒
        /// </summary>
        public long SamplingElapsedSeconds
        {
            get { return ((long)(EndTime - BeginTime).TotalSeconds); }
        }

        /// <summary>
        /// 采样时间段内总接口请求数
        /// </summary>
        public long TotalRequestTimes { get; set; }

        /// <summary>
        /// 采样时间段内总接口请求失败数
        /// </summary>
        public long TotalFailTimes { get; set; }

        /// <summary>
        /// 采样时间段内接口调用总耗时毫秒数
        /// </summary>
        public long TotalRequestElapsedMilliseconds { get; set; }

        /// <summary>
        /// 采样时间段内接口调用最大耗时毫秒数
        /// </summary>
        public long MaxElapsedTime { get; set; }

        /// <summary>
        /// 采样时间段内接口调用最小耗时毫秒数
        /// </summary>
        public long MinElapsedTime { get; set; }
    }
}
